package com.cqrt.mapper;

import com.cqrt.dto.RTTemplateLinkDocDTO;
import com.cqrt.entity.RTKnowTempDocDO;
import com.cqrt.entity.RTPlanJobLinkDO;
import com.cqrt.entity.RTTemplateLinkDocDO;
import com.ty.ppm.model.entity.job.Job;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.BaseMapper;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface RTProjectKnowledgeLinkMapper extends BaseMapper<RTTemplateLinkDocDO> {

    void batchInsertTempLinkDoc(@Param("templateLinkDocDTO") List<RTTemplateLinkDocDTO> templateLinkDocDTO);

    @Deprecated
    BigInteger queryJobById(BigInteger activityId);

    @Deprecated
    @Select("select planoid from RT_PRJ_PLAN_JOB_LINK where joboid=TO_NUMBER(#{activityID})")
    BigInteger selectPlanById(String activityID);

    @Deprecated
    @Select("select latest_versionid from RT_PRJ_TEMPLATE_DOC_LINK where project_id=#{planId}")
    List<BigInteger> selectJobById(BigInteger planId);

    @Deprecated
    List<RTTemplateLinkDocDO> queryDetailById(BigInteger id);

    @Delete("delete from RT_PRJ_TEMPLATE_DOC_LINK where project_id=#{projectId}")
    void deleteDocById(BigInteger projectId);

    boolean isExistLink(String activityID);

    @Select("select * from RT_PRJ_PLAN_JOB_LINK  where JOBOID=#{id}")
    RTPlanJobLinkDO selectIsJobById(BigInteger id);

    List<RTTemplateLinkDocDTO> selectDocById(BigInteger id);

    @Select("select * from TY_PJ_JOB where OID=TO_NUMBER(#{activityID})")
    Job selectById(String activityID);

    List<BigInteger> selectPjIdById(BigInteger id);

    void deleteDocByOId(BigInteger oid,String objectNumber);

    List<BigInteger> selectNumberName(String projectOid,String objectNumber, String name);

    List<BigInteger> selectlastVersionId(BigInteger oid, String objectNumber);

    void deleteRomate(String latestVersionID);

    void insertKnowTempDoc(RTKnowTempDocDO rtKnowTempDocDO);

    List<RTKnowTempDocDO> selectKnowTempDoc(BigInteger planOid);
    List<RTKnowTempDocDO> selectKnowTempDocByPlanActivityId(BigInteger planActivityId);

    void deleteKnowTempDoc(String name,String jobName);

    List<RTKnowTempDocDO> selectKnowTempDocByJobId(BigInteger id);

    List<String> selectIsTemp(String name, String jobname);

}
